package com.ying.dogying.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ying.dogying.entity.ImUserMessage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ying.dogying.entity.dto.ImUserMessageDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 李华明
 * @since 2020-06-10
 */
public interface ImUserMessageDao extends BaseMapper<ImUserMessage> {

    IPage<ImUserMessageDto> selectByParams(Page page, @Param(Constants.WRAPPER) QueryWrapper<ImUserMessageDto> orderByDesc);

    @Transactional
    @Update("update im_user_message set status = 1 ${ew.customSqlSegment}")
    void updateToReaded(@Param(Constants.WRAPPER) QueryWrapper<ImUserMessageDto> queryWrapper);
}
